package com.ymatou.iapi.godmch.testcase;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.godmch.parameter.CreateCodeBean;
import com.ymatou.iapi.godmch.parameter.RemoveCodeBean;
import com.ymatou.iapi.godmch.parameter.bindmchBean;
import com.ymatou.iapi.godmch.parameter.checkBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.godmch.service.CreateCodeCall;
import com.ymatou.iapi.godmch.service.checkCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.invite_code;
import com.ymttest.database.sqlwapper.godmch.invite_codeWapper;
/**
*邀请码
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_check{
	private static checkBean bean;
	private static checkCall call;
	 private invite_codeWapper inviteCodeWapper=new invite_codeWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("邀请码");
	}

	@Before
	public void caseUp() {
		bean=new checkBean();
		call=new checkCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_001() {
		Logger.start(true,"校验邀请码,验证永久用效-渠道商邀请渠道-(渠道商-渠道)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_002() {
		Logger.start(true,"校验邀请码,验证永久用效-Vip渠道商邀请渠道-(Vip渠道商-渠道商)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			//设置vip
			GodmchManageCallService.SetVip(codebean.getMchId());
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_003() {
		Logger.start(true,"校验邀请码,验证永久用效-渠道商邀请代理-(Vip渠道商-代理)");
		try {
			//代理用户
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int agentId = DGUserCallService.UserCreateCall(usercreateBean);
			
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			//设置vip
			GodmchManageCallService.SetVip(codebean.getMchId());
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建其他商户的代理
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			Logger.comment("其他商户的代理");
			List<createmchBean> createListBean=GodmchManageCallService.InitcreatemchBeanForAgent(mchId,agentId);
			GodmchManageCallService.createmchCallForAgent(createListBean.toArray(new createmchBean[createListBean.size()]));
			
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_004() {
		Logger.start(true,"校验邀请码,验证永久用效-渠道商邀请渠道+代理-(渠道商+代理)");
		try {
			//代理用户
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId_agent = DGUserCallService.UserCreateCall(usercreateBean);
			
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道1
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//渠道1 邀请码
			CreateCodeBean createCodeBean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId, true);
			CreateCodeCall createCodeCall=GodmchManageCallService.createCodeCall(createCodeBean);
			//创建渠道2
		    createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId_agent);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//绑定一个渠道与另外一个渠道绑定
			bindmchBean bindmchBean=GodmchManageCallService.InitbindmchBean(mchId_agent, createCodeCall.getCode());
			GodmchManageCallService.bindmchcall(bindmchBean);
			
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");			
				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_005() {
		Logger.start(true,"校验邀请码,验证不是永久用效-未过期-渠道商邀请渠道-(渠道商-渠道)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(false);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_006() {
		Logger.start(true,"校验邀请码,验证不是永久用效-未过期-Vip渠道商邀请渠道-(Vip渠道商-渠道商)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			//设置vip
			GodmchManageCallService.SetVip(codebean.getMchId());
			codebean.setIsPermanently(false);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_007() {
		Logger.start(true,"校验邀请码,验证不是永久用效-未过期-渠道商邀请代理-(渠道商-代理)");
		try {
			//代理用户
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId_agent = DGUserCallService.UserCreateCall(usercreateBean);
			
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(false);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道1
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//渠道1 邀请码
			CreateCodeBean createCodeBean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId, true);
			CreateCodeCall createCodeCall=GodmchManageCallService.createCodeCall(createCodeBean);
			//创建渠道2
		    createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId_agent);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//绑定一个渠道与另外一个渠道绑定
			bindmchBean bindmchBean=GodmchManageCallService.InitbindmchBean(mchId_agent, createCodeCall.getCode());
			GodmchManageCallService.bindmchcall(bindmchBean);
			
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_008() {
		Logger.start(true,"校验邀请码,验证不是永久用效-未过期-渠道商邀请渠道+代理-(渠道商+代理)");
		try {
			//代理用户
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId_agent = DGUserCallService.UserCreateCall(usercreateBean);
			
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(false);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道1
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//渠道1 邀请码
			CreateCodeBean createCodeBean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId, true);
			CreateCodeCall createCodeCall=GodmchManageCallService.createCodeCall(createCodeBean);
			//创建渠道2
		    createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId_agent);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//绑定一个渠道与另外一个渠道绑定
			bindmchBean bindmchBean=GodmchManageCallService.InitbindmchBean(mchId_agent, createCodeCall.getCode());
			GodmchManageCallService.bindmchcall(bindmchBean);
			
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");			
							
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_009() {
		Logger.start(true,"校验邀请码,验证不是永久用效-已过期-被邀请对象是渠道(渠道商-渠道)");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			
//			invite_code model2=inviteCodeWapper.selectByPrimaryKey(Integer.parseInt(codeCall.getCode()));
			invite_code model2=inviteCodeWapper.selectByCode(codeCall.getCode());
			Calendar Cal=java.util.Calendar.getInstance();   
	        Cal.setTime(model2.getCreateTime());   
	        Cal.add(java.util.Calendar.DAY_OF_YEAR,-2);  //目前配置一天后过期 
	        inviteCodeWapper.updateExpireByCode(codeCall.getCode(), Cal.getTime());
	        
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(false, call.getValid(), "验证返回成功Valid值");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_check_025() {
		Logger.start(true,"校验邀请码,验证永久用效-渠道商1邀请渠道2-渠道2再邀请渠道1,返回错误(目前没有对商户校验，只对邀请码校验)");
		try {
			//渠道1
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId1 = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId2 = DGUserCallService.UserCreateCall(usercreateBean);
			//创建渠道1
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId1);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//创建渠道1邀请码
			CreateCodeBean codebean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId1, true);
			CreateCodeCall codeCall1=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道2
			createmchBean createBean2=GodmchManageCallService.InitcreatemchBeanForChannel(mchId2);
			GodmchManageCallService.createmchCallForChannel(createBean2);
			//创建渠道2邀请码
			codebean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId2, true);
			CreateCodeCall codeCall2=GodmchManageCallService.createCodeCall(codebean);
			Logger.comment("渠道1绑定渠道2");
			bindmchBean bindmchBean=GodmchManageCallService.InitbindmchBean(mchId2, codeCall1.getCode());
			GodmchManageCallService.bindmchcall(bindmchBean);
			
		    bean.setCode(codeCall2.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(false, call.getValid(), "验证返回成功Valid值");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_028() {
		Logger.start(true,"校验邀请码,验证作废再邀请-返回错误");
		try {
			//渠道用户
//			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
//			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);
			//创建邀请码
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//作废邀请码
			RemoveCodeBean removeCodeBea=GodmchManageCallService.InitremoveBean(codebean.getMchId(), codeCall.getCode());
			GodmchManageCallService.removecall(removeCodeBea);
		    bean.setCode(codeCall.getCode());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(false, call.getValid(), "验证返回成功Valid值");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_030() {
		Logger.start(true,"校验邀请码,验证邀请码不存在-返回错误");
		try {
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);

		    bean.setCode(codeCall.getCode()+9999);
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(false, call.getValid(), "验证返回成功Valid值");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_032() {
		Logger.start(true,"校验邀请码,验证邀请码为空-返回错误");
		try {
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);

		    bean.setCode(null);
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("4001", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals(true, call.getMessage().contains("邀请码不能为空"), "验证返回成功Message值");			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_033() {
		//1、校验邀请码接口，新增国家码参数，非必选项目，有值场景下，需check该国结算币种是否与分享该邀请码的商户结算币种是否一致
		Logger.start(true,"校验邀请码,验证永久用效-渠道商邀请渠道+代理-(渠道商+代理)-国家不为空-该国结算币种与分享该邀请码的商户结算币种是一致");
		try {
			//代理用户
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId_agent = DGUserCallService.UserCreateCall(usercreateBean);
			
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道1
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//渠道1 邀请码
			CreateCodeBean createCodeBean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId, true);
			CreateCodeCall createCodeCall=GodmchManageCallService.createCodeCall(createCodeBean);
			//创建渠道2
		    createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId_agent);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//绑定一个渠道与另外一个渠道绑定
			bindmchBean bindmchBean=GodmchManageCallService.InitbindmchBean(mchId_agent, createCodeCall.getCode());
			GodmchManageCallService.bindmchcall(bindmchBean);
			
		    bean.setCode(codeCall.getCode());
		    bean.setCountry(createBean1.getCountry());
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");			
				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_034() {
		//1、校验邀请码接口，新增国家码参数，非必选项目，有值场景下，需check该国结算币种是否与分享该邀请码的商户结算币种是否一致
		Logger.start(true,"校验邀请码,验证永久用效-渠道商邀请渠道+代理-(渠道商+代理)-国家不为空-该国结算币种与分享该邀请码的商户结算币种不一致(现在返回成功 跨国20191023修改)");
		try {
			//代理用户
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId_agent = DGUserCallService.UserCreateCall(usercreateBean);
			
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道1
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//渠道1 邀请码
			CreateCodeBean createCodeBean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId, true);
			CreateCodeCall createCodeCall=GodmchManageCallService.createCodeCall(createCodeBean);
			//创建渠道2
		    createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId_agent);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//绑定一个渠道与另外一个渠道绑定
			bindmchBean bindmchBean=GodmchManageCallService.InitbindmchBean(mchId_agent, createCodeCall.getCode());
			GodmchManageCallService.bindmchcall(bindmchBean);
			
		    bean.setCode(codeCall.getCode());
		    bean.setCountry("HKG");
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");			
					
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_035() {
		//1、校验邀请码接口，新增国家码参数，非必选项目，有值场景下，需check该国结算币种是否与分享该邀请码的商户结算币种是否一致
		Logger.start(true,"校验邀请码,验证永久用效-渠道商邀请渠道+代理-(渠道商+代理)-国家不存在(国家不存在不做拦截,现在返回成功 跨国20191023修改)");
		try {
			//代理用户
			UserCreateBean usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean);
			usercreateBean = DGUserCallService.initSellerUsercreateBean();
			int mchId_agent = DGUserCallService.UserCreateCall(usercreateBean);
			
			CreateCodeBean codebean=GodmchManageCallService.CreateAllMsgSellerMch();
			codebean.setIsPermanently(true);
			CreateCodeCall codeCall=GodmchManageCallService.createCodeCall(codebean);
			//创建渠道1
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//渠道1 邀请码
			CreateCodeBean createCodeBean=GodmchManageCallService.InitcreateCodeBeanForAgent(mchId, true);
			CreateCodeCall createCodeCall=GodmchManageCallService.createCodeCall(createCodeBean);
			//创建渠道2
		    createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId_agent);
			GodmchManageCallService.createmchCallForChannel(createBean1);
			//绑定一个渠道与另外一个渠道绑定
			bindmchBean bindmchBean=GodmchManageCallService.InitbindmchBean(mchId_agent, createCodeCall.getCode());
			GodmchManageCallService.bindmchcall(bindmchBean);
			
		    bean.setCode(codeCall.getCode());
		    bean.setCountry("aaa");
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");			
					
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_036() {
		Logger.start(true,"校验邀请码,验证国内渠道商专属邀请码(GNQDS)，校验逻辑调整-返回成功");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);

			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
		    bean.setCode("GNQDS");//国内渠道商专属邀请码
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_037() {
		Logger.start(true,"校验邀请码,验证国内渠道商专属邀请码(GNQDS)小写，校验逻辑调整-返回成功，不做小写限制");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);

			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
		    bean.setCode("gnqds");//国内渠道商专属邀请码
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_check_038() {
		Logger.start(true,"校验邀请码,验证国内渠道商专属邀请码(GNQDS)大小写混合，校验逻辑调整-返回成功，不做小写限制");
		try {
			//渠道用户
			UserCreateBean usercreateBean2 = DGUserCallService.initSellerUsercreateBean();
			int mchId = DGUserCallService.UserCreateCall(usercreateBean2);

			//创建渠道
			createmchBean createBean1=GodmchManageCallService.InitcreatemchBeanForChannel(mchId);
			GodmchManageCallService.createmchCallForChannel(createBean1);
		    bean.setCode("gnQdS");//国内渠道商专属邀请码
			call.setData(bean);
			call.callService();			
			//验证点
	        Logger.verifyEquals("200", call.getStatus1(), "验证返回成功status值");
	        Logger.verifyEquals("请求成功", call.getMessage(), "验证返回成功Message值");
	        Logger.verifyEquals(true, call.getValid(), "验证返回成功Valid值");
	        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}